import request from '@/utils/request';

console.log("-----see--------");

export function toPlaceOrder(params:any){
  return request('/xwyl/order/toPlaceOrder', {
    method: 'POST',
    requestType:'form',
    data: {
      ...params,
      method: 'post',
    },
  });
}

export function withdraw(params:any){
  return request('/xwyl/delivery/withdraw', {
    method: 'POST',
    requestType:'form',
    data: {
      ...params,
      method: 'post',
    },
  });
}


export function saveOrderApi(params){
  return request('/xwyl/orderNew/saveOrder', {
    method: 'POST',
    headers:{
      'Content-Type': 'application/json',
      'authorization':`${sessionStorage.getItem('token')}`
    },
    data: {
      ...params,
      method: 'post',
    },
  });
}

export function updateOrder(params){
  return request('/xwyl/orderNew/updateOrder', {
    method: 'POST',
    headers:{
      'Content-Type': 'application/json',
      'authorization':`${sessionStorage.getItem('token')}`
    },
    data: {
      ...params,
      method: 'post',
    },
  });
}

export async function myOrderData(params: any) {
  var data =  request('/xwyl/order/myOrderData', {
    params,
  });
  return data;
}

export async function orderQuantityData(params: any) {
  var data =  request('/xwyl/order/orderQuantityData', {
    params,
  });
  return data;
}

export async function exportOrder(params: any) {
  var data =  request('/xwyl/order/exportOrder', {
    params,
  });
  return data;
}

export async function orderDetailDataById(params: any) {
  var data =  request('/xwyl/orderNew/orderDetailDataById', {
    params,
  });
  return data;
}

export async function exportorderSend(params: any) {
  var data =  request('/xwyl/delivery/exportorderSend', {
    params,
  });
  return data;
}


export async function completeOrder(params: any) {
  var data =  request('/xwyl/order/completeOrder', {
    method: 'POST',
    params,
  });
  return data;
}

export async function recvListData(params: any) {
  var data =  request('/xwyl/dealer/recvListData', {
    params,
  });
  return data;
}

export  function orderSendListData(params: any) {
  var data =  request('/xwyl/delivery/orderSendListData', {
    params,
  });
  return data;
}

export async function orderDeliveryDataById(params: any){
  var data =  request('/xwyl/delivery/orderDeliveryDataById', {
    params,
  });
  return data;
}

export function delivery(params:any){
  return request('/xwyl/delivery/delivery', {
    method: 'POST',
    headers:{
      'Content-Type': 'application/json',
      'authorization':`${sessionStorage.getItem('token')}`
    },
    data: {
      ...params,
      method: 'post',
    },
  });
}

export function modifyOrder(params:any){
  return request('/xwyl/orderNew/modifyOrder', {
    method: 'POST',
    headers:{
      'Content-Type': 'application/json',
      'authorization':`${sessionStorage.getItem('token')}`
    },
    data: {
      ...params,
      method: 'post',
    },
  });
}

export  function changeOrder(params: any) {
  var data =  request('/xwyl/order/changeOrder', {
    method: 'POST',
    params,
  });
  return data;
}

export  function deliveryDataList(params: any) {
  var data =  request('/xwyl/delivery/deliveryDataList', {
    params,
  });
  return data;
}

export  function invoiceDetailListData(params: any) {
  var data =  request('/xwyl/delivery/invoiceDetailListData', {
    params,
  });
  return data;
}

export  function takeListData(params: any) {
  var data =  request('/xwyl/take/takeListData', {
    params,
  });
  return data;
}

export  function ticketDataByDealerId(params: any) {
  var data =  request('/xwyl/dealer/ticketDataByDealerId', {
    params,
  });
  return data;
}


export  function take(params: any) {
  var data =  request('/xwyl/take/take', {
    method: 'POST',
    headers:{
      'Content-Type': 'application/json',
      'authorization':`${sessionStorage.getItem('token')}`
    },
    data: {
      ...params,
      method: 'post',
    },
  });
  return data;
}

export  function deliveryCheckList(params: any) {
  var data =  request('/xwyl/delivery/deliveryCheckList', {
    method: 'POST',
    headers:{
      'Content-Type': 'application/json',
      'authorization':`${sessionStorage.getItem('token')}`
    },
    data: {
      ...params,
    },
  });
  return data;
}


export  function checkDelivery(params: any) {
  var data =  request('/xwyl/delivery/checkDelivery', {
    method: 'POST',
    headers:{
      'Content-Type': 'application/json',
      'authorization':`${sessionStorage.getItem('token')}`
    },
    data: {
      ...params,
    },
  });
  return data;
}

export function wareList(params: any) {
  var data =  request('/xwyl/warehouse/listOfAll', {
    method: 'POST',
  });
  return data;
}

export function receiptListData(params: any) {
  var data =  request('/xwyl/take/receiptListData', {
    method: 'POST',
    params,
  });
  return data;
}


export function myReceiptData(params: any) {
  var data =  request('/xwyl/take/myReceiptData', {
    method: 'POST',
    params,
  });
  return data;
}


export function receiptDataById(params: any) {
  var data =  request('/xwyl/take/receiptDataById', {
    method: 'POST',
    params,
  });
  return data;
}

export function auditReceipt(params:any){
  return request('/xwyl/take/auditReceipt', {
    method: 'POST',
    requestType:'form',
    data: {
      ...params,
      method: 'post',
    },
  });
}


export function updateInvoiceIsBill(params:any){
  return request('/xwyl/delivery/updateInvoiceIsBill', {
    method: 'POST',
    requestType:'form',
    data: {
      ...params,
      method: 'post',
    },
  });
}


export function exportDelivery(params:any){
  return request('/xwyl/delivery/exportDelivery', {
    method: 'POST',
    requestType:'form',
    data: {
      ...params,
      method: 'post',
    },
  });
}

export function exportDeliveryCheck(params:any){
  return request('/xwyl/delivery/exportDeliveryCheck', {
    method: 'POST',
    headers:{
      'Content-Type': 'application/json',
      'authorization':`${sessionStorage.getItem('token')}`
    },
    data: {
      ...params,
    },
  });
}

export function toPlaceOrderNew(params:any){
  return request('/xwyl/orderNew/toPlaceOrder', {
    method: 'POST',
    requestType:'form',
    data: {
      ...params,
      method: 'post',
    },
  });
}

export async function orderProcessById(params: any) {
  var data =  request('/xwyl/orderNew/orderProcessById', {
    params,
  });
  return data;
}

export async function getList4Dealer(params: any) {
  var data =  request('/xwyl/dealerGift/getList4Dealer', {
    params,
  });
  return data;
}

export async function orderBillInfo(params: any) {
  var data =  request('/xwyl/factory/getOrderBillInfo', {
    params,
  });
  return data;
}

export async function orderDetailSendListData(params: any) {
  params.complete = 0
  var data =  request('/xwyl/delivery/orderDetailSendListData', {
    params,
  });
  return data;
}

export async function exportorderSend2(params: any) {
  var data =  request('/xwyl/delivery/exportorderSend2', {
    params,
  });
  return data;
}


